﻿using RBAC.MaHaiBo.API.Application.Command.UserCommand;
using RBAC.MaHaiBo.Repository;
using MediatR;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.UserHandler
{
    public class UserUpdateCommandHandlers : IRequestHandler<UserUpdateCommand, int>
    {
        IUserService User;

        public UserUpdateCommandHandlers(IUserService User)
        {
            this.User = User;
        }

        public async Task<int> Handle(UserUpdateCommand request, CancellationToken cancellationToken)
        {
            return await User.UpdateUser(new Entity.UserInfo() { uId= request.Uid, accountNumber = request.accountNumber, password = request.password, department = request.department, uName = request.uName, uSex = request.uSex, provinceId = request.provinceId, cityId = request.cityId, countyId = request.countyId, address = request.address });
        }
    }

}
